home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl151s.zip / INCLUDE / EXPR.H < prev    next >
C/C++ Source or Header  |  1997-05-31  |  3KB  |  85 lines

  1. /*
  2.  * 68K/386 32-bit C compiler.
  3.  *
  4.  * copyright (c) 1996, David Lindauer
  5.  * 
  6.  * This compiler is intended for educational use.  It may not be used
  7.  * for profit without the express written consent of the author.
  8.  *
  9.  * It may be freely redistributed, as long as this notice remains intact
  10.  * and sources are distributed along with any executables derived from them.
  11.  *
  12.  * The author is not responsible for damages, either direct or consequential,
  13.  * that may arise from use of this software.
  14.  *
  15.  * v1.5 August 1996
  16.  * David Lindauer, gclind01@starbase.spd.louisville.edu
  17.  *
  18.  * Credits to Mathew Brandt for original K&R C compiler
  19.  *
  20.  */
  21.  
  22. /*      expression tree descriptions    */
  23.  
  24. enum e_node {
  25.         en_void,        /* used for parameter lists */
  26.     en_cb, en_cub, en_cw, en_cuw, en_cl, en_cul, en_cf, en_cd, en_cp, en_cld,
  27.         en_icon, en_lcon,en_iucon, en_lucon, en_rcon, en_fcon, en_lrcon,
  28.     en_ccon, en_labcon, en_nacon, en_autocon, en_absacon, en_nalabcon,
  29.         en_napccon, en_b_ref, en_w_ref, en_l_ref, en_ub_ref, en_uw_ref,
  30.     en_floatref, en_doubleref, en_longdoubleref, en_autoreg, en_trapcall,
  31.         en_ul_ref, en_fcall, en_fcallb, en_intcall, en_tempref, en_regref,
  32.     en_pfcallb, en_pfcall, en_pcallblock,
  33.     en_add, en_sub, en_mul, en_mod,
  34.         en_div, en_lsh, en_rsh, en_cond, en_assign, en_refassign, en_eq, en_ne,
  35.         en_asadd, en_assub, en_asmul, en_asdiv, en_asmod, en_asrsh,
  36.     en_asumul, en_asudiv, en_asumod, en_pmul,
  37.         en_aslsh, en_asand, en_asor, en_asxor, en_uminus, en_not, en_compl,
  38.         en_lt, en_le, en_gt, en_ge, en_and, en_or, en_land, en_lor,
  39.         en_xor, en_ainc, en_adec, en_umul, en_udiv, en_umod, en_ugt,
  40.         en_uge, en_ule, en_ult, en_moveblock, en_stackblock, en_callblock,
  41.     en_pdiv, en_alsh, en_arsh, en_asarsh,en_asalsh, en_bits};
  42.  
  43. /*      statement node descriptions     */
  44.  
  45. enum e_stmt {
  46.         st_line, st_expr, st_while, st_for, st_do, st_if, st_switch,
  47.         st_case, st_goto, st_break, st_continue, st_label, st_asm,
  48.         st_return, st_block, st__genword };
  49.  
  50. struct enode {
  51.         enum e_node    nodetype;
  52.     char bits;
  53.     char startbit;
  54.     char cflags;
  55.     long size; /* For block moves */
  56.         union {
  57.                 long            i;
  58.                 double          f;
  59.                 char            *sp;
  60.                 struct enode    *p[2];
  61.                 } v;
  62.         };
  63.  
  64. struct snode {
  65.         enum e_stmt     stype;
  66.         struct snode    *next;          /* next statement */
  67.         struct enode    *exp;           /* condition or expression */
  68.         struct snode    *s1, *s2,*lst;       /* internal statements &lineno*/
  69.     /* changed */
  70.     struct snode          *label;         /* label number for goto */
  71.         };
  72.  
  73. struct cse {
  74.         struct cse      *next;
  75.         struct enode    *exp;           /* optimizable expression */
  76.         short           uses;           /* number of uses */
  77.         short            duses;          /* number of dereferenced uses */
  78.     char        size;        /* Size of the expresion */
  79.         char             voidf;          /* cannot optimize flag */
  80.         char             reg;            /* allocated register */
  81.         };
  82.  
  83. #define ENODE struct enode
  84. #define SNODE struct snode
  85. #define CSE struct cse